module phy_state

    implicit none

    type phy_state_type
        real, allocatable :: u(:)
        real, allocatable :: v(:)
        real, allocatable :: w(:)
        real, allocatable :: q(:)
    contains
        procedure :: variable_query
    end type phy_state_type
    
    integer num_saved_time_step

contains

    real function variable_query(this, var_name, time_step) result(res)
        class(phy_state_type), intent(in) :: this
        character(*), intent(in) :: var_name
        integer, intent(in) :: time_step
        
        select case(var_name)
        case("u")
            res = this%u(time_step)
        case("v")
            res = this%v(time_step)
        case("w")
            res = this%w(time_step)
        case("q")
            res = this%q(time_step)
        end select
        
        return
    end function variable_query

end module phy_state
